 package tools.packet;



import client.BuddylistEntry;
import handling.opcode.BuddyOpcode;
import handling.opcode.SendPacketOpcode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import tools.data.output.MaplePacketLittleEndianWriter;

import java.util.Collection;



















 public class BuddyListPacket
 {
/*  24 */   private static final Logger log = LogManager.getLogger(BuddyListPacket.class);










   public static byte[] buddylistMessage(int message) {
/*  36 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  37 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  39 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/*  40 */     mplew.write(message);

/*  42 */     return mplew.getPacket();
   }

   public static byte[] updateBuddylist(Collection<BuddylistEntry> buddylist) {
/*  46 */     return updateBuddylist(buddylist, BuddyOpcode.FriendRes_LoadAccountIDOfCharacterFriend_Done.getValue());
   }




   public static byte[] updateBuddylist(Collection<BuddylistEntry> buddylist, int mode) {
/*  53 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  54 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  56 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/*  57 */     mplew.write(mode);
/*  58 */     if (mode != BuddyOpcode.FriendRes_SendSingleFriendInfo.getValue()) {
/*  59 */       mplew.writeInt(buddylist.size());
     }
/*  61 */     for (BuddylistEntry buddy : buddylist) {
/*  62 */       mplew.writeInt(buddy.getCharacterId());
/*  63 */       mplew.writeAsciiString(buddy.getName(), 13);
/*  64 */       mplew.write(buddy.isVisible() ? 0 : 1);
/*  65 */       mplew.writeInt((buddy.getChannel() == -1) ? -1 : (buddy.getChannel() - 1));
/*  66 */       mplew.writeAsciiString(buddy.getGroup(), 18);
/*  67 */       mplew.writeInt(0);

/*  69 */       mplew.writeHexString("00 AE 1A 0B 64 FC 34 11 10 0D AB 0F 68");
/*  70 */       mplew.writeAsciiString("", 13);
/*  71 */       mplew.writeZeroBytes(247);
     }

/*  74 */     return mplew.getPacket();
   }




   public static byte[] updateBuddylistEnd() {
/*  81 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  82 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  84 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/*  85 */     mplew.write(BuddyOpcode.FriendRes_SetMessengerMode.getValue());
/*  86 */     mplew.writeInt(0);

/*  88 */     return mplew.getPacket();
   }




   public static byte[] requestBuddylistAdd(int chrIdFrom, String nameFrom, int channel, int levelFrom, int jobFrom) {
/*  95 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  96 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  98 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/*  99 */     mplew.write(BuddyOpcode.FriendRes_Invite.getValue());
/* 100 */     mplew.writeBool(false);
/* 101 */     mplew.writeInt(chrIdFrom);
/* 102 */     mplew.writeInt(0);
/* 103 */     mplew.writeMapleAsciiString(nameFrom);
/* 104 */     mplew.writeInt(levelFrom);
/* 105 */     mplew.writeInt(jobFrom);
/* 106 */     mplew.writeInt(0);
/* 107 */     mplew.writeInt(chrIdFrom);
/* 108 */     mplew.writeAsciiString(nameFrom, 13);
/* 109 */     mplew.write(1);
/* 110 */     mplew.writeInt(channel);
/* 111 */     mplew.writeAsciiString("未指定群组", 18);
/* 112 */     mplew.writeInt(0);
/* 113 */     mplew.writeAsciiString(nameFrom, 13);
/* 114 */     for (int i = 0; i < 65; i++) {
/* 115 */       mplew.writeInt(0);
     }
/* 117 */     mplew.write(0);
/* 118 */     return mplew.getPacket();
   }




   public static byte[] updateBuddyChannel(int chrId, int channel, String name) {
/* 125 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 126 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 128 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/* 129 */     mplew.write(BuddyOpcode.FriendRes_Notify.getValue());
/* 130 */     mplew.writeInt(chrId);
/* 131 */     mplew.writeInt(0);
/* 132 */     mplew.write(0);
/* 133 */     mplew.writeInt(channel);
/* 134 */     mplew.write(0);
/* 135 */     mplew.write(1);

/* 137 */     return mplew.getPacket();
   }




   public static byte[] updateBuddyCapacity(int capacity) {
/* 144 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 145 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 147 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/* 148 */     mplew.write(BuddyOpcode.FriendRes_IncMaxCount_Done.getValue());
/* 149 */     mplew.write(capacity);

/* 151 */     return mplew.getPacket();
   }




   public static byte[] updateBuddyNamer(BuddylistEntry buddylist, int mode) {
/* 158 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 159 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 161 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/* 162 */     mplew.write(mode);
/* 163 */     mplew.writeInt(buddylist.getCharacterId());
/* 164 */     mplew.writeInt(buddylist.getCharacterId());
/* 165 */     mplew.writeInt(buddylist.getCharacterId());
/* 166 */     mplew.writeAsciiString(buddylist.getName(), 13);
/* 167 */     mplew.write(buddylist.isVisible() ? 7 : 5);
/* 168 */     mplew.writeInt((buddylist.getChannel() == -1) ? -1 : (buddylist.getChannel() - 1));
/* 169 */     mplew.writeAsciiString(buddylist.getGroup(), 18);
/* 170 */     mplew.writeInt(buddylist.getCharacterId());
/* 171 */     mplew.writeAsciiString(buddylist.getName(), 13);
/* 172 */     mplew.writeAsciiString("", 13);
/* 173 */     for (int i = 0; i < 64; i++) {
/* 174 */       mplew.writeInt(0);
     }
/* 176 */     mplew.writeZeroBytes(3);
/* 177 */     return mplew.getPacket();
   }




   public static byte[] NoBuddy(int buddyid, int mode, boolean linkaccount) {
/* 184 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 185 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 187 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/* 188 */     mplew.write(mode);
/* 189 */     mplew.writeBool(linkaccount);
/* 190 */     mplew.writeInt(buddyid);
/* 191 */     return mplew.getPacket();
   }




   public static byte[] BuddyMess(int mode, String name) {
/* 198 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 199 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 201 */     mplew.writeShort(SendPacketOpcode.BUDDYLIST.getValue());
/* 202 */     mplew.write(mode);
/* 203 */     mplew.writeMapleAsciiString(name);
/* 204 */     return mplew.getPacket();
   }
 }


/* Location:              C:\PGX\Server.jar!\tools\packet\BuddyListPacket.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */